package com.example.controller;

import com.example.feignclient.UserFeignClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * Created by linving on 2017/1/6.
 */
@RestController
public class ConsumerController {
    @Autowired
    RestTemplate restTemplate;
    @Autowired
    UserFeignClient userFeignClient;

//    @GetMapping(value = "/test")
//    public String test(String name) {
//        return restTemplate.getForEntity("http://user-provider/test?name=" + name, String.class).getBody();
//    }

    @GetMapping(value = "/test")
    public String test(String name) {
        return userFeignClient.test(name);
    }
}
